import { createStore,applyMiddleware } from 'redux'
import logger from 'redux-logger'
//导入reducer
import reducer from './reducer'

import { persistReducer,persistStore } from 'redux-persist'
import storage from 'redux-persist/lib/storage'

//对reducer进行持久化处理
var persistedReducer = persistReducer( { key:'redux',storage  }, reducer )

//实例化store
export var store = createStore(persistedReducer,applyMiddleware(logger));

//对store进行持久化处理
export var persistor = persistStore(store)